package cn.chengpengper.im.common.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/*@formatter:off*/

/**
 * ____________________
 * < 神兽护体，永无bug! >
 * --------------------
 *
 * @author huchengpeng
 * @version v1.0.0
 * @date 2024/9/8 18:35
 * @description 命令类型
 */

/*@formatter:on*/

@Getter
@AllArgsConstructor
public enum ImCmdType {

    LOGIN(1, "登录"),
    HEART_HEAT(2, "心跳"),
    FORCE_LOGOUT(3, "强制下线"),
    PRIVATE_MESSAGE(4, "私聊消息"),
    GROUP_MESSAGE(5, "群发消息"),
    ;
    private final Integer code;

    private final String desc;

    public static ImCmdType fromCode(Integer code) {
        for (ImCmdType typeEnum : values()) {
            if (typeEnum.code.equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }
}
